package xcmg.device.enums;

import io.swagger.annotations.ApiModelProperty;

public enum OrderTypeEnum {
    COMMON("普通", "P"),
    BASIC_MACHINE("基础机", "J"),
    SELF_MADE_PARTS("自制件", "Z"),
    DIRECT("直投", "C")
    ;

    // 成员变量
    private String name;
    private String type;

    /**
     * 构造方法
     * @param name
     * @param type
     */
    private OrderTypeEnum(String name, String type) {
        this.name = name;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    /**
     * 根据值获取名称
     * @param type
     * @return
     */
    public static String getName(String type) {
        if(type == null || type == ""){
            return "";
        }
        for (OrderTypeEnum m : OrderTypeEnum.values()) {
            if (m.getType().equals(type)) {
                return m.name;
            }
        }
        return "";
    }


}
